<!DOCTYPE html>
<html lang="zh" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta content="width=device-width, initial-scale=1.0" name="viewport">
    <meta content="" name="keywords">
    <meta content="" name="description">
    <link href="favicon.ico" rel="shortcut icon">
    <th:block th:include="include :: header('知识课堂列表')"/>
    <link rel="stylesheet" th:href="@{/css/bootstrap.min.css}"/>
    <link rel="stylesheet" th:href="@{/css/font-awesome.min.css}"/>
    <!--swiper-->
    <link rel="stylesheet" th:href="@{/dist/libs/swiper/idangerous.swiper2.7.6.css}">
    <!-- bootstrap-table 表格插件样式 -->
    <link rel="stylesheet" th:href="@{/ajax/libs/bootstrap-table/bootstrap-table.min.css}"/>
    <link rel="stylesheet" th:href="@{/css/animate.css}"/>
    <link rel="stylesheet" th:href="@{/css/style.css}"/>
    <link rel="stylesheet" th:href="@{/ruoyi/css/ry-ui.css}"/>
    <link rel="stylesheet" th:href="@{/css/my.css}"/>

    <!--页面样式文件-->
    <link rel="stylesheet" th:href="@{/./dist/css/main.css}">
    <link rel="stylesheet" th:href="@{/./dist/css/media.css}">
</head>
<body class="bd-bg">
<!--右侧主体-->
<div class="contentPart">
    <div class="main">
        <!--搜索区域-->
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li hidden="hidden">
                            课堂类别id<input  name="kctypeId" id="kctypeId" th:value="${kctypeId}">
                        </li>
                        <li>
                            标题：
                            <input name="title" type="text"/>
                        </li>

                        <li class="select-time mr-40">
                            <label>选择时间： </label>
                            <div class="fl inputTime-outer">
                                <input type="text" class="time-input" id="beginTime" th:value="${beginTime}"
                                       placeholder="开始时间"
                                       name="params[beginTime]"/>
                                <div class="icon-rili"></div>
                            </div>
                            <span>&#45;&#45;</span>
                            <div class="fl inputTime-outer">
                                <input type="text" class="time-input" id="endTime" th:value="${endTime}"
                                       placeholder="结束时间"
                                       name="params[endTime]"/>
                                <div class="icon-rili"></div>
                            </div>
                        </li>

                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>

                        </li>
                    </ul>
                </div>
            </form>
            <a class="btn fl-r mlr_8 btn-success" href="javascript:history.go(-1)"><i
                    class="fa fa-backward"></i>返回</a>
        </div>

        <!--只是列表-->
        <div class="row rowNew konwledge-list" id="konwledge-list">

        </div>
    </div>

    <div class="col-sm-12 select-table table-striped">
        <table data-mobile-responsive="true" id="bootstrap-table"></table>
    </div>


</div>
<div th:include="include :: footer"></div>
<!-- 遮罩层 -->
<script th:src="@{/ajax/libs/layer/layer.min.js}"></script>
<script th:src="@{/ajax/libs/layui/layui.js}"></script>
<script th:src="@{/ruoyi/js/common.js?v=3.4.0}"></script>

<script th:src="@{/ruoyi/js/ry-ui.js?v=3.4.0}"></script>

<script th:src="@{/ruoyi/js/my-common-js.js}"></script>

<script th:src="@{/ajax/libs/bootstrap-paginator/bootstrap-paginator.js}"></script>
<script th:inline="javascript">

    var prefix = ctx + "system/ncKnowledgeClass";

    $(function () {
        var options = {
            url: prefix + "/listByKCTypeId",
            modalName: "知识课堂",
            search : false,
            showSearch : false,
            showColumns : false,
            showExport : false,
            showRefresh : false,
            showToggle : false,
            onLoadSuccess: function (data) {
                showKCList(data);
            },
            columns: [{
                checkbox: true,
                visible: false,
            },
                {
                    field: 'kcId',
                    title: '自增主键 ',
                    visible: false
                },
                {
                    field: 'title',
                    title: '文章标题  ',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'pic',
                    title: '图片',
                    visible: false,
                    formatter: function (value, row, index) {
                        return $.table.showPic(value);
                    }
                },
                {
                    field: 'kcContent',
                    title: '文章内容',
                    visible: false,
                    formatter: function (value, row, index) {
                        return $.table.tooltip(getText(value), 20);
                    }
                },
                {
                    field: 'kcStatus',
                    title: '文章状态',
                    sortable: true,
                    visible: false,
                    formatter: function (value, row, index) {
                        if (0 === value) {
                            return '正常';
                        } else if (1 === value) {
                            return '关闭';
                        }

                    }
                },
                {
                    field: 'kctypeId',
                    title: '分类id',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'typeName',
                    title: '分类名称',
                    sortable: true,
                    visible: false,
                },
                {
                    title: '操作',
                    align: 'center',
                    visible: false,
                    formatter: function (value, row, index) {
                        var actions = [];
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });


    function showKC(data) {
        var kcId = $(data).parents('.item-div').attr("doc-id");
        window.location.href = "/system/ncKnowledgeClass/showKC/" + data;
    }


    function showKCList(data) {

        $("#konwledge-list").html("");

        for (var i = 0; i < data.rows.length; i++) {
            $("#konwledge-list").append([' <div class="item-div konwledge-item col-xs-12 col-sm-12 col-md-6">',
                '                <div class="item-main clearfix">',
                '                    <div class="k-s-item-left col-xs-4" onclick="showKC('+ data.rows[i].kcId +')">',
                '                        <img alt="" src=" ' + data.rows[i].pic + '"></a>',
                '                    </div>',
                '                    <div class="k-s-item-right col-xs-12">',
                '                        <div class="item-right-main" onclick="showKC('+ data.rows[i].kcId +')">',
                '                            <div class="title"><a>' + data.rows[i].title + '</a></div>',
                '                            <div class="page show-detail">',
                '                            ' + getText(data.rows[i].kcContent) + '                               ',
                '                            </div>',
                '                        </div>',
                '                        <div class="item-right-btm clearfix">',
                '                            <div class="btm-auther fl">',
                '                                '+ data.rows[i].createBy +' | '+ data.rows[i].createTime  + '',
                '                            </div>',
                '                            <div class="btm-more fr"><a onclick="showKCListByKCId(this)">更多</a></div>',
                '                        </div>',
                '                    </div>',
                '                </div>',
                '            </div>'].join(""));
        }

        $('.k-s-item-left').each(function () {
            $(this).siblings(".k-s-item-right").eq(0).height($(this).height() + 22)
        });
        $(window).resize(function () {
            $('.k-s-item-left').each(function () {
                $(this).siblings(".k-s-item-right").eq(0).height($(this).height() + 22)
            })
        });
    }
    setTitle("知识课堂",false)

</script>
</body>
</html>
